//商品管理-商品即秒排期-配置文件
App.util.ns('Admin.Goods.GsJmSchedule');
Admin.Goods.GsJmSchedule.Conf = {
    columns: [
        {name: '商品', width: '200px', value: function(item){
            return item.goods ? item.goods.name : '未分配';
        }},
        {name: '排期名', width: '120px', value: function(item){
            return item.jmschedule ? item.jmschedule.name : '未分配';
        }},
        {name: '库存', width: '120px',value: 'inventory'},
        {name: '卖出数量', width: '120px',value: 'sell_total'},
        {name: '价格', width: '120px',value: 'price'},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        // {type: 'chosen', name: 'goods_id', title: '商品',
        //     items: App.models.get('goods-all'),
        //     item_key: 'id',
        //     item_name: 'name',
        //     value_key: 'id'
        // },

        {type: 'selectLists', name: 'goods_id', title: '商品', required: true,
            data_id: 'id',
            data_name: function(item){
                return item.id+':'+item.name;
            },
            dataTable: {
                baseUrl: '/admin/goods/goods',
                dataUrl: 'lists?status=1',
                data_id: 'id',
                data_name: 'name',
                table: {
                    id: 'id',
                    main: 0,
                    columns: [
                        {name: '商品名', value: 'name'},
                        {name: '商品原价', value: 'price_original'},
                        {name: '商品体验价', value: 'price_lowest'},
                        {name: '库存', value: 'inventory'}
                    ]
                },
                filter: [
                    {type: 'keywords'},
                ],
                height: '720px'
            }
        },
        {type: 'input', name: 'inventory', title: '库存', required: true, rule: {
            type: 'num'
        }},
        {type: 'input', name: 'sell_total', title: '卖出数量', required: true, rule: {
            type: 'num'
        }},
        {type: 'input', name: 'price', title: '价格', required: true, rule: {
            type: 'str',
            range: [0, 30]
        }},
    ]
};